package com.qf.advice;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * @author 汤奇
 * @version V1.0
 * @Project BookPro
 * @Package com.qf.advice
 * @Description: 环绕通知:
 *                  先执行环绕通知, 例如: 开启事务
*                   再执行核心service中的业务增删改查方法
 *                  再执行环绕通知 例如: 提交事务
 * @Date 2022/6/6 11:34
 */
public class MyAroundAdvice implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        System.out.println("=====环绕通知: 开启事务MethodInterceptor====");
        Object proceed = methodInvocation.proceed(); //调用执行核心service中的业务方法
        System.out.println("=====环绕通知: 提交事务MethodInterceptor====");
        return proceed;
    }
}
